﻿#region Using directives

using System;
using System.Data;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;

using NetROS.Tiers.Entities;
using NetROS.Tiers.Data;

#endregion

namespace NetROS.Tiers.Data.Bases
{	
	///<summary>
	/// This class is the base class for any <see cref="OSAGPromjenaProviderBase"/> implementation.
	/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
	///</summary>
	public abstract partial class OSAGPromjenaProviderBaseCore : EntityProviderBase<NetROS.Tiers.Entities.OSAGPromjena, NetROS.Tiers.Entities.OSAGPromjenaKey>
	{		
		#region Get from Many To Many Relationship Functions
		#endregion	
		
		#region Delete Methods

		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to delete.</param>
		/// <returns>Returns true if operation suceeded.</returns>
		public override bool Delete(TransactionManager transactionManager, NetROS.Tiers.Entities.OSAGPromjenaKey key)
		{
			return Delete(transactionManager, key.ID);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="iD">. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public bool Delete(System.Int32 iD)
		{
			return Delete(null, iD);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iD">. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public abstract bool Delete(TransactionManager transactionManager, System.Int32 iD);		
		
		#endregion Delete Methods
		
		#region Get By Foreign Key Functions
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblKonto key.
		///		FK_tblOSAGPromjena_tblKonto Description: 
		/// </summary>
		/// <param name="iDKontoIspravka"></param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDKontoIspravka(System.Int32 iDKontoIspravka)
		{
			int count = -1;
			return GetByIDKontoIspravka(iDKontoIspravka, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblKonto key.
		///		FK_tblOSAGPromjena_tblKonto Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDKontoIspravka"></param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		/// <remarks></remarks>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDKontoIspravka(TransactionManager transactionManager, System.Int32 iDKontoIspravka)
		{
			int count = -1;
			return GetByIDKontoIspravka(transactionManager, iDKontoIspravka, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblKonto key.
		///		FK_tblOSAGPromjena_tblKonto Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDKontoIspravka"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDKontoIspravka(TransactionManager transactionManager, System.Int32 iDKontoIspravka, int start, int pageLength)
		{
			int count = -1;
			return GetByIDKontoIspravka(transactionManager, iDKontoIspravka, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblKonto key.
		///		fK_tblOSAGPromjena_tblKonto Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="iDKontoIspravka"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDKontoIspravka(System.Int32 iDKontoIspravka, int start, int pageLength)
		{
			int count =  -1;
			return GetByIDKontoIspravka(null, iDKontoIspravka, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblKonto key.
		///		fK_tblOSAGPromjena_tblKonto Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="iDKontoIspravka"></param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDKontoIspravka(System.Int32 iDKontoIspravka, int start, int pageLength,out int count)
		{
			return GetByIDKontoIspravka(null, iDKontoIspravka, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblKonto key.
		///		FK_tblOSAGPromjena_tblKonto Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDKontoIspravka"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public abstract NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDKontoIspravka(TransactionManager transactionManager, System.Int32 iDKontoIspravka, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblKonto1 key.
		///		FK_tblOSAGPromjena_tblKonto1 Description: 
		/// </summary>
		/// <param name="iDKontoTroska"></param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDKontoTroska(System.Int32 iDKontoTroska)
		{
			int count = -1;
			return GetByIDKontoTroska(iDKontoTroska, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblKonto1 key.
		///		FK_tblOSAGPromjena_tblKonto1 Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDKontoTroska"></param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		/// <remarks></remarks>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDKontoTroska(TransactionManager transactionManager, System.Int32 iDKontoTroska)
		{
			int count = -1;
			return GetByIDKontoTroska(transactionManager, iDKontoTroska, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblKonto1 key.
		///		FK_tblOSAGPromjena_tblKonto1 Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDKontoTroska"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDKontoTroska(TransactionManager transactionManager, System.Int32 iDKontoTroska, int start, int pageLength)
		{
			int count = -1;
			return GetByIDKontoTroska(transactionManager, iDKontoTroska, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblKonto1 key.
		///		fK_tblOSAGPromjena_tblKonto1 Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="iDKontoTroska"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDKontoTroska(System.Int32 iDKontoTroska, int start, int pageLength)
		{
			int count =  -1;
			return GetByIDKontoTroska(null, iDKontoTroska, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblKonto1 key.
		///		fK_tblOSAGPromjena_tblKonto1 Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="iDKontoTroska"></param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDKontoTroska(System.Int32 iDKontoTroska, int start, int pageLength,out int count)
		{
			return GetByIDKontoTroska(null, iDKontoTroska, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblKonto1 key.
		///		FK_tblOSAGPromjena_tblKonto1 Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDKontoTroska"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public abstract NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDKontoTroska(TransactionManager transactionManager, System.Int32 iDKontoTroska, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblKonto2 key.
		///		FK_tblOSAGPromjena_tblKonto2 Description: 
		/// </summary>
		/// <param name="iDKontoNabave"></param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDKontoNabave(System.Int32 iDKontoNabave)
		{
			int count = -1;
			return GetByIDKontoNabave(iDKontoNabave, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblKonto2 key.
		///		FK_tblOSAGPromjena_tblKonto2 Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDKontoNabave"></param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		/// <remarks></remarks>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDKontoNabave(TransactionManager transactionManager, System.Int32 iDKontoNabave)
		{
			int count = -1;
			return GetByIDKontoNabave(transactionManager, iDKontoNabave, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblKonto2 key.
		///		FK_tblOSAGPromjena_tblKonto2 Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDKontoNabave"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDKontoNabave(TransactionManager transactionManager, System.Int32 iDKontoNabave, int start, int pageLength)
		{
			int count = -1;
			return GetByIDKontoNabave(transactionManager, iDKontoNabave, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblKonto2 key.
		///		fK_tblOSAGPromjena_tblKonto2 Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="iDKontoNabave"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDKontoNabave(System.Int32 iDKontoNabave, int start, int pageLength)
		{
			int count =  -1;
			return GetByIDKontoNabave(null, iDKontoNabave, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblKonto2 key.
		///		fK_tblOSAGPromjena_tblKonto2 Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="iDKontoNabave"></param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDKontoNabave(System.Int32 iDKontoNabave, int start, int pageLength,out int count)
		{
			return GetByIDKontoNabave(null, iDKontoNabave, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblKonto2 key.
		///		FK_tblOSAGPromjena_tblKonto2 Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDKontoNabave"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public abstract NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDKontoNabave(TransactionManager transactionManager, System.Int32 iDKontoNabave, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblOSAmortizacijskaGrupa key.
		///		FK_tblOSAGPromjena_tblOSAmortizacijskaGrupa Description: 
		/// </summary>
		/// <param name="iDOSAG"></param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDOSAG(System.Int32 iDOSAG)
		{
			int count = -1;
			return GetByIDOSAG(iDOSAG, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblOSAmortizacijskaGrupa key.
		///		FK_tblOSAGPromjena_tblOSAmortizacijskaGrupa Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDOSAG"></param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		/// <remarks></remarks>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDOSAG(TransactionManager transactionManager, System.Int32 iDOSAG)
		{
			int count = -1;
			return GetByIDOSAG(transactionManager, iDOSAG, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblOSAmortizacijskaGrupa key.
		///		FK_tblOSAGPromjena_tblOSAmortizacijskaGrupa Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDOSAG"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDOSAG(TransactionManager transactionManager, System.Int32 iDOSAG, int start, int pageLength)
		{
			int count = -1;
			return GetByIDOSAG(transactionManager, iDOSAG, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblOSAmortizacijskaGrupa key.
		///		fK_tblOSAGPromjena_tblOSAmortizacijskaGrupa Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="iDOSAG"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDOSAG(System.Int32 iDOSAG, int start, int pageLength)
		{
			int count =  -1;
			return GetByIDOSAG(null, iDOSAG, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblOSAmortizacijskaGrupa key.
		///		fK_tblOSAGPromjena_tblOSAmortizacijskaGrupa Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="iDOSAG"></param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDOSAG(System.Int32 iDOSAG, int start, int pageLength,out int count)
		{
			return GetByIDOSAG(null, iDOSAG, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblOSAmortizacijskaGrupa key.
		///		FK_tblOSAGPromjena_tblOSAmortizacijskaGrupa Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDOSAG"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public abstract NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDOSAG(TransactionManager transactionManager, System.Int32 iDOSAG, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblOSGrupa key.
		///		FK_tblOSAGPromjena_tblOSGrupa Description: 
		/// </summary>
		/// <param name="iDOSGrupa"></param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDOSGrupa(System.Int32 iDOSGrupa)
		{
			int count = -1;
			return GetByIDOSGrupa(iDOSGrupa, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblOSGrupa key.
		///		FK_tblOSAGPromjena_tblOSGrupa Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDOSGrupa"></param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		/// <remarks></remarks>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDOSGrupa(TransactionManager transactionManager, System.Int32 iDOSGrupa)
		{
			int count = -1;
			return GetByIDOSGrupa(transactionManager, iDOSGrupa, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblOSGrupa key.
		///		FK_tblOSAGPromjena_tblOSGrupa Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDOSGrupa"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDOSGrupa(TransactionManager transactionManager, System.Int32 iDOSGrupa, int start, int pageLength)
		{
			int count = -1;
			return GetByIDOSGrupa(transactionManager, iDOSGrupa, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblOSGrupa key.
		///		fK_tblOSAGPromjena_tblOSGrupa Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="iDOSGrupa"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDOSGrupa(System.Int32 iDOSGrupa, int start, int pageLength)
		{
			int count =  -1;
			return GetByIDOSGrupa(null, iDOSGrupa, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblOSGrupa key.
		///		fK_tblOSAGPromjena_tblOSGrupa Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="iDOSGrupa"></param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDOSGrupa(System.Int32 iDOSGrupa, int start, int pageLength,out int count)
		{
			return GetByIDOSGrupa(null, iDOSGrupa, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblOSGrupa key.
		///		FK_tblOSAGPromjena_tblOSGrupa Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDOSGrupa"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public abstract NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDOSGrupa(TransactionManager transactionManager, System.Int32 iDOSGrupa, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblOsnovnoSredstvo key.
		///		FK_tblOSAGPromjena_tblOsnovnoSredstvo Description: 
		/// </summary>
		/// <param name="iDOS"></param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDOS(System.Int32 iDOS)
		{
			int count = -1;
			return GetByIDOS(iDOS, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblOsnovnoSredstvo key.
		///		FK_tblOSAGPromjena_tblOsnovnoSredstvo Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDOS"></param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		/// <remarks></remarks>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDOS(TransactionManager transactionManager, System.Int32 iDOS)
		{
			int count = -1;
			return GetByIDOS(transactionManager, iDOS, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblOsnovnoSredstvo key.
		///		FK_tblOSAGPromjena_tblOsnovnoSredstvo Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDOS"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDOS(TransactionManager transactionManager, System.Int32 iDOS, int start, int pageLength)
		{
			int count = -1;
			return GetByIDOS(transactionManager, iDOS, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblOsnovnoSredstvo key.
		///		fK_tblOSAGPromjena_tblOsnovnoSredstvo Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="iDOS"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDOS(System.Int32 iDOS, int start, int pageLength)
		{
			int count =  -1;
			return GetByIDOS(null, iDOS, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblOsnovnoSredstvo key.
		///		fK_tblOSAGPromjena_tblOsnovnoSredstvo Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="iDOS"></param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDOS(System.Int32 iDOS, int start, int pageLength,out int count)
		{
			return GetByIDOS(null, iDOS, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOSAGPromjena_tblOsnovnoSredstvo key.
		///		FK_tblOSAGPromjena_tblOsnovnoSredstvo Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDOS"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.OSAGPromjena objects.</returns>
		public abstract NetROS.Tiers.Entities.TList<OSAGPromjena> GetByIDOS(TransactionManager transactionManager, System.Int32 iDOS, int start, int pageLength, out int count);
		
		#endregion

		#region Get By Index Functions
		
		/// <summary>
		/// 	Gets a row from the DataSource based on its primary key.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to retrieve.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <returns>Returns an instance of the Entity class.</returns>
		public override NetROS.Tiers.Entities.OSAGPromjena Get(TransactionManager transactionManager, NetROS.Tiers.Entities.OSAGPromjenaKey key, int start, int pageLength)
		{
			return GetByID(transactionManager, key.ID, start, pageLength);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the primary key PK_tblOSAGPromjena index.
		/// </summary>
		/// <param name="iD"></param>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.OSAGPromjena"/> class.</returns>
		public NetROS.Tiers.Entities.OSAGPromjena GetByID(System.Int32 iD)
		{
			int count = -1;
			return GetByID(null,iD, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_tblOSAGPromjena index.
		/// </summary>
		/// <param name="iD"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.OSAGPromjena"/> class.</returns>
		public NetROS.Tiers.Entities.OSAGPromjena GetByID(System.Int32 iD, int start, int pageLength)
		{
			int count = -1;
			return GetByID(null, iD, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_tblOSAGPromjena index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iD"></param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.OSAGPromjena"/> class.</returns>
		public NetROS.Tiers.Entities.OSAGPromjena GetByID(TransactionManager transactionManager, System.Int32 iD)
		{
			int count = -1;
			return GetByID(transactionManager, iD, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_tblOSAGPromjena index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iD"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.OSAGPromjena"/> class.</returns>
		public NetROS.Tiers.Entities.OSAGPromjena GetByID(TransactionManager transactionManager, System.Int32 iD, int start, int pageLength)
		{
			int count = -1;
			return GetByID(transactionManager, iD, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_tblOSAGPromjena index.
		/// </summary>
		/// <param name="iD"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.OSAGPromjena"/> class.</returns>
		public NetROS.Tiers.Entities.OSAGPromjena GetByID(System.Int32 iD, int start, int pageLength, out int count)
		{
			return GetByID(null, iD, start, pageLength, out count);
		}
		
				
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_tblOSAGPromjena index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iD"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.OSAGPromjena"/> class.</returns>
		public abstract NetROS.Tiers.Entities.OSAGPromjena GetByID(TransactionManager transactionManager, System.Int32 iD, int start, int pageLength, out int count);
						
		#endregion "Get By Index Functions"
	
		#region Custom Methods
		
		
		#endregion

		#region Helper Functions	
		
		/// <summary>
		/// Fill a NetROS.Tiers.Entities.TList&lt;OSAGPromjena&gt; From a DataReader.
		/// </summary>
		/// <param name="reader">Datareader</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">number of rows.</param>
		/// <returns>a <see cref="NetROS.Tiers.Entities.TList&lt;OSAGPromjena&gt;"/></returns>
		public static NetROS.Tiers.Entities.TList<OSAGPromjena> Fill(IDataReader reader, NetROS.Tiers.Entities.TList<OSAGPromjena> rows, int start, int pageLength)
		{
		// advance to the starting row
		for (int i = 0; i < start; i++)
		{
			if (!reader.Read())
			return rows; // not enough rows, just return
		}
		for (int i = 0; i < pageLength; i++)
		{
			if (!reader.Read())
			break; // we are done
			string key = null;
			
			NetROS.Tiers.Entities.OSAGPromjena c = null;
			if (DataRepository.Provider.UseEntityFactory)
			{
			key = new System.Text.StringBuilder("OSAGPromjena")
			.Append("|").Append((reader.IsDBNull(((int)NetROS.Tiers.Entities.OSAGPromjenaColumn.ID - 1))?(int)0:(System.Int32)reader[((int)NetROS.Tiers.Entities.OSAGPromjenaColumn.ID - 1)]).ToString()).ToString();
			c = EntityManager.LocateOrCreate<OSAGPromjena>(
			key.ToString(), // EntityTrackingKey
			"OSAGPromjena",  //Creational Type
			DataRepository.Provider.EntityCreationalFactoryType,  //Factory used to create entity
			DataRepository.Provider.EnableEntityTracking); // Track this entity?
			}
			else
			{
			c = new NetROS.Tiers.Entities.OSAGPromjena();
			}
			
			if (!DataRepository.Provider.EnableEntityTracking ||
			c.EntityState == EntityState.Added ||
			(DataRepository.Provider.EnableEntityTracking &&
			((DataRepository.Provider.CurrentLoadPolicy == LoadPolicy.PreserveChanges && c.EntityState == EntityState.Unchanged) ||
			(DataRepository.Provider.CurrentLoadPolicy == LoadPolicy.DiscardChanges && (c.EntityState == EntityState.Unchanged ||
								c.EntityState == EntityState.Changed)))))
						{
			c.SuppressEntityEvents = true;
			c.ID = (System.Int32)reader["ID"];
			c.IDOS = (System.Int32)reader["IDOS"];
			c.IDOSGrupa = (System.Int32)reader["IDOSGrupa"];
			c.IDKontoNabave = (System.Int32)reader["IDKontoNabave"];
			c.IDKontoIspravka = (System.Int32)reader["IDKontoIspravka"];
			c.IDKontoTroska = (System.Int32)reader["IDKontoTroska"];
			c.IDOSAG = (System.Int32)reader["IDOSAG"];
			c.DatumOd = (System.DateTime)reader["DatumOd"];
			c.DatumDo = reader.IsDBNull(reader.GetOrdinal("DatumDo")) ? null : (System.DateTime?)reader["DatumDo"];
			c.EntityTrackingKey = key;
			c.AcceptChanges();
			c.SuppressEntityEvents = false;
			}
			rows.Add(c);
		}
		return rows;
		}		
		/// <summary>
		/// Refreshes the <see cref="NetROS.Tiers.Entities.OSAGPromjena"/> object from the <see cref="IDataReader"/>.
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader"/> to read from.</param>
		/// <param name="entity">The <see cref="NetROS.Tiers.Entities.OSAGPromjena"/> object to refresh.</param>
		public static void RefreshEntity(IDataReader reader, NetROS.Tiers.Entities.OSAGPromjena entity)
		{
			if (!reader.Read()) return;
			
			entity.ID = (System.Int32)reader["ID"];
			entity.IDOS = (System.Int32)reader["IDOS"];
			entity.IDOSGrupa = (System.Int32)reader["IDOSGrupa"];
			entity.IDKontoNabave = (System.Int32)reader["IDKontoNabave"];
			entity.IDKontoIspravka = (System.Int32)reader["IDKontoIspravka"];
			entity.IDKontoTroska = (System.Int32)reader["IDKontoTroska"];
			entity.IDOSAG = (System.Int32)reader["IDOSAG"];
			entity.DatumOd = (System.DateTime)reader["DatumOd"];
			entity.DatumDo = reader.IsDBNull(reader.GetOrdinal("DatumDo")) ? null : (System.DateTime?)reader["DatumDo"];
			entity.AcceptChanges();
		}
		
		/// <summary>
		/// Refreshes the <see cref="NetROS.Tiers.Entities.OSAGPromjena"/> object from the <see cref="DataSet"/>.
		/// </summary>
		/// <param name="dataSet">The <see cref="DataSet"/> to read from.</param>
		/// <param name="entity">The <see cref="NetROS.Tiers.Entities.OSAGPromjena"/> object.</param>
		public static void RefreshEntity(DataSet dataSet, NetROS.Tiers.Entities.OSAGPromjena entity)
		{
			DataRow dataRow = dataSet.Tables[0].Rows[0];
			
			entity.ID = (System.Int32)dataRow["ID"];
			entity.IDOS = (System.Int32)dataRow["IDOS"];
			entity.IDOSGrupa = (System.Int32)dataRow["IDOSGrupa"];
			entity.IDKontoNabave = (System.Int32)dataRow["IDKontoNabave"];
			entity.IDKontoIspravka = (System.Int32)dataRow["IDKontoIspravka"];
			entity.IDKontoTroska = (System.Int32)dataRow["IDKontoTroska"];
			entity.IDOSAG = (System.Int32)dataRow["IDOSAG"];
			entity.DatumOd = (System.DateTime)dataRow["DatumOd"];
			entity.DatumDo = Convert.IsDBNull(dataRow["DatumDo"]) ? null : (System.DateTime?)dataRow["DatumDo"];
			entity.AcceptChanges();
		}
		#endregion 
		
		#region DeepLoad Methods
		/// <summary>
		/// Deep Loads the <see cref="IEntity"/> object with criteria based of the child 
		/// property collections only N Levels Deep based on the <see cref="DeepLoadType"/>.
		/// </summary>
		/// <remarks>
		/// Use this method with caution as it is possible to DeepLoad with Recursion and traverse an entire object graph.
		/// </remarks>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="entity">The <see cref="NetROS.Tiers.Entities.OSAGPromjena"/> object to load.</param>
		/// <param name="deep">Boolean. A flag that indicates whether to recursively save all Property Collection that are descendants of this instance. If True, saves the complete object graph below this object. If False, saves this object only. </param>
		/// <param name="deepLoadType">DeepLoadType Enumeration to Include/Exclude object property collections from Load.</param>
		/// <param name="childTypes">NetROS.Tiers.Entities.OSAGPromjena Property Collection Type Array To Include or Exclude from Load</param>
		/// <param name="innerList">A collection of child types for easy access.</param>
	    /// <exception cref="ArgumentNullException">entity or childTypes is null.</exception>
	    /// <exception cref="ArgumentException">deepLoadType has invalid value.</exception>
		internal override void DeepLoad(TransactionManager transactionManager, NetROS.Tiers.Entities.OSAGPromjena entity, bool deep, DeepLoadType deepLoadType, System.Type[] childTypes, DeepSession innerList)
		{
			if(entity == null)
				return;

			#region IDKontoIspravkaSource	
			if (CanDeepLoad(entity, "Konto|IDKontoIspravkaSource", deepLoadType, innerList) 
				&& entity.IDKontoIspravkaSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.IDKontoIspravka;
				Konto tmpEntity = EntityManager.LocateEntity<Konto>(EntityLocator.ConstructKeyFromPkItems(typeof(Konto), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.IDKontoIspravkaSource = tmpEntity;
				else
					entity.IDKontoIspravkaSource = DataRepository.KontoProvider.GetByID(transactionManager, entity.IDKontoIspravka);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IDKontoIspravkaSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IDKontoIspravkaSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.KontoProvider.DeepLoad(transactionManager, entity.IDKontoIspravkaSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion IDKontoIspravkaSource

			#region IDKontoTroskaSource	
			if (CanDeepLoad(entity, "Konto|IDKontoTroskaSource", deepLoadType, innerList) 
				&& entity.IDKontoTroskaSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.IDKontoTroska;
				Konto tmpEntity = EntityManager.LocateEntity<Konto>(EntityLocator.ConstructKeyFromPkItems(typeof(Konto), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.IDKontoTroskaSource = tmpEntity;
				else
					entity.IDKontoTroskaSource = DataRepository.KontoProvider.GetByID(transactionManager, entity.IDKontoTroska);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IDKontoTroskaSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IDKontoTroskaSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.KontoProvider.DeepLoad(transactionManager, entity.IDKontoTroskaSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion IDKontoTroskaSource

			#region IDKontoNabaveSource	
			if (CanDeepLoad(entity, "Konto|IDKontoNabaveSource", deepLoadType, innerList) 
				&& entity.IDKontoNabaveSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.IDKontoNabave;
				Konto tmpEntity = EntityManager.LocateEntity<Konto>(EntityLocator.ConstructKeyFromPkItems(typeof(Konto), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.IDKontoNabaveSource = tmpEntity;
				else
					entity.IDKontoNabaveSource = DataRepository.KontoProvider.GetByID(transactionManager, entity.IDKontoNabave);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IDKontoNabaveSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IDKontoNabaveSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.KontoProvider.DeepLoad(transactionManager, entity.IDKontoNabaveSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion IDKontoNabaveSource

			#region IDOSAGSource	
			if (CanDeepLoad(entity, "OSAmortizacijskaGrupa|IDOSAGSource", deepLoadType, innerList) 
				&& entity.IDOSAGSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.IDOSAG;
				OSAmortizacijskaGrupa tmpEntity = EntityManager.LocateEntity<OSAmortizacijskaGrupa>(EntityLocator.ConstructKeyFromPkItems(typeof(OSAmortizacijskaGrupa), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.IDOSAGSource = tmpEntity;
				else
					entity.IDOSAGSource = DataRepository.OSAmortizacijskaGrupaProvider.GetByID(transactionManager, entity.IDOSAG);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IDOSAGSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IDOSAGSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.OSAmortizacijskaGrupaProvider.DeepLoad(transactionManager, entity.IDOSAGSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion IDOSAGSource

			#region IDOSGrupaSource	
			if (CanDeepLoad(entity, "OSGrupa|IDOSGrupaSource", deepLoadType, innerList) 
				&& entity.IDOSGrupaSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.IDOSGrupa;
				OSGrupa tmpEntity = EntityManager.LocateEntity<OSGrupa>(EntityLocator.ConstructKeyFromPkItems(typeof(OSGrupa), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.IDOSGrupaSource = tmpEntity;
				else
					entity.IDOSGrupaSource = DataRepository.OSGrupaProvider.GetByID(transactionManager, entity.IDOSGrupa);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IDOSGrupaSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IDOSGrupaSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.OSGrupaProvider.DeepLoad(transactionManager, entity.IDOSGrupaSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion IDOSGrupaSource

			#region IDOSSource	
			if (CanDeepLoad(entity, "OsnovnoSredstvo|IDOSSource", deepLoadType, innerList) 
				&& entity.IDOSSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.IDOS;
				OsnovnoSredstvo tmpEntity = EntityManager.LocateEntity<OsnovnoSredstvo>(EntityLocator.ConstructKeyFromPkItems(typeof(OsnovnoSredstvo), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.IDOSSource = tmpEntity;
				else
					entity.IDOSSource = DataRepository.OsnovnoSredstvoProvider.GetByID(transactionManager, entity.IDOS);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IDOSSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IDOSSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.OsnovnoSredstvoProvider.DeepLoad(transactionManager, entity.IDOSSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion IDOSSource
			
			//used to hold DeepLoad method delegates and fire after all the local children have been loaded.
			Dictionary<string, KeyValuePair<Delegate, object>> deepHandles = new Dictionary<string, KeyValuePair<Delegate, object>>();
			
			//Fire all DeepLoad Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles.Values)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			deepHandles = null;
		}
		
		#endregion 
		
		#region DeepSave Methods

		/// <summary>
		/// Deep Save the entire object graph of the NetROS.Tiers.Entities.OSAGPromjena object with criteria based of the child 
		/// Type property array and DeepSaveType.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="entity">NetROS.Tiers.Entities.OSAGPromjena instance</param>
		/// <param name="deepSaveType">DeepSaveType Enumeration to Include/Exclude object property collections from Save.</param>
		/// <param name="childTypes">NetROS.Tiers.Entities.OSAGPromjena Property Collection Type Array To Include or Exclude from Save</param>
		/// <param name="innerList">A Hashtable of child types for easy access.</param>
		internal override bool DeepSave(TransactionManager transactionManager, NetROS.Tiers.Entities.OSAGPromjena entity, DeepSaveType deepSaveType, System.Type[] childTypes, DeepSession innerList)
		{	
			if (entity == null)
				return false;
							
			#region Composite Parent Properties
			//Save Source Composite Properties, however, don't call deep save on them.  
			//So they only get saved a single level deep.
			
			#region IDKontoIspravkaSource
			if (CanDeepSave(entity, "Konto|IDKontoIspravkaSource", deepSaveType, innerList) 
				&& entity.IDKontoIspravkaSource != null)
			{
				DataRepository.KontoProvider.Save(transactionManager, entity.IDKontoIspravkaSource);
				entity.IDKontoIspravka = entity.IDKontoIspravkaSource.ID;
			}
			#endregion 
			
			#region IDKontoTroskaSource
			if (CanDeepSave(entity, "Konto|IDKontoTroskaSource", deepSaveType, innerList) 
				&& entity.IDKontoTroskaSource != null)
			{
				DataRepository.KontoProvider.Save(transactionManager, entity.IDKontoTroskaSource);
				entity.IDKontoTroska = entity.IDKontoTroskaSource.ID;
			}
			#endregion 
			
			#region IDKontoNabaveSource
			if (CanDeepSave(entity, "Konto|IDKontoNabaveSource", deepSaveType, innerList) 
				&& entity.IDKontoNabaveSource != null)
			{
				DataRepository.KontoProvider.Save(transactionManager, entity.IDKontoNabaveSource);
				entity.IDKontoNabave = entity.IDKontoNabaveSource.ID;
			}
			#endregion 
			
			#region IDOSAGSource
			if (CanDeepSave(entity, "OSAmortizacijskaGrupa|IDOSAGSource", deepSaveType, innerList) 
				&& entity.IDOSAGSource != null)
			{
				DataRepository.OSAmortizacijskaGrupaProvider.Save(transactionManager, entity.IDOSAGSource);
				entity.IDOSAG = entity.IDOSAGSource.ID;
			}
			#endregion 
			
			#region IDOSGrupaSource
			if (CanDeepSave(entity, "OSGrupa|IDOSGrupaSource", deepSaveType, innerList) 
				&& entity.IDOSGrupaSource != null)
			{
				DataRepository.OSGrupaProvider.Save(transactionManager, entity.IDOSGrupaSource);
				entity.IDOSGrupa = entity.IDOSGrupaSource.ID;
			}
			#endregion 
			
			#region IDOSSource
			if (CanDeepSave(entity, "OsnovnoSredstvo|IDOSSource", deepSaveType, innerList) 
				&& entity.IDOSSource != null)
			{
				DataRepository.OsnovnoSredstvoProvider.Save(transactionManager, entity.IDOSSource);
				entity.IDOS = entity.IDOSSource.ID;
			}
			#endregion 
			#endregion Composite Parent Properties

			// Save Root Entity through Provider
			if (!entity.IsDeleted)
				this.Save(transactionManager, entity);
			
			//used to hold DeepSave method delegates and fire after all the local children have been saved.
			Dictionary<Delegate, object> deepHandles = new Dictionary<Delegate, object>();
			//Fire all DeepSave Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			
			// Save Root Entity through Provider, if not already saved in delete mode
			if (entity.IsDeleted)
				this.Save(transactionManager, entity);
				

			deepHandles = null;
						
			return true;
		}
		#endregion
	} // end class
	
	#region OSAGPromjenaChildEntityTypes
	
	///<summary>
	/// Enumeration used to expose the different child entity types 
	/// for child properties in <c>NetROS.Tiers.Entities.OSAGPromjena</c>
	///</summary>
	public enum OSAGPromjenaChildEntityTypes
	{
		
		///<summary>
		/// Composite Property for <c>Konto</c> at IDKontoIspravkaSource
		///</summary>
		[ChildEntityType(typeof(Konto))]
		Konto,
			
		///<summary>
		/// Composite Property for <c>OSAmortizacijskaGrupa</c> at IDOSAGSource
		///</summary>
		[ChildEntityType(typeof(OSAmortizacijskaGrupa))]
		OSAmortizacijskaGrupa,
			
		///<summary>
		/// Composite Property for <c>OSGrupa</c> at IDOSGrupaSource
		///</summary>
		[ChildEntityType(typeof(OSGrupa))]
		OSGrupa,
			
		///<summary>
		/// Composite Property for <c>OsnovnoSredstvo</c> at IDOSSource
		///</summary>
		[ChildEntityType(typeof(OsnovnoSredstvo))]
		OsnovnoSredstvo,
		}
	
	#endregion OSAGPromjenaChildEntityTypes
	
	#region OSAGPromjenaFilterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="SqlFilterBuilder&lt;OSAGPromjenaColumn&gt;"/> class
	/// that is used exclusively with a <see cref="OSAGPromjena"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class OSAGPromjenaFilterBuilder : SqlFilterBuilder<OSAGPromjenaColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the OSAGPromjenaFilterBuilder class.
		/// </summary>
		public OSAGPromjenaFilterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the OSAGPromjenaFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public OSAGPromjenaFilterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the OSAGPromjenaFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public OSAGPromjenaFilterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion OSAGPromjenaFilterBuilder
	
	#region OSAGPromjenaParameterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="ParameterizedSqlFilterBuilder&lt;OSAGPromjenaColumn&gt;"/> class
	/// that is used exclusively with a <see cref="OSAGPromjena"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class OSAGPromjenaParameterBuilder : ParameterizedSqlFilterBuilder<OSAGPromjenaColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the OSAGPromjenaParameterBuilder class.
		/// </summary>
		public OSAGPromjenaParameterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the OSAGPromjenaParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public OSAGPromjenaParameterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the OSAGPromjenaParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public OSAGPromjenaParameterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion OSAGPromjenaParameterBuilder
} // end namespace
